﻿using System.Collections.Generic;
using CST_276_Lab_3;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Test_Project_CST_276_Lab_3
{
    [TestClass]
    public class Lab3DeskAutomationFixture
    {

        #region Members
        AutomationController automationController;
        DeskAssemblyLine deskAssemblyLineOne;
        DeskAssemblyLine deskAssemblyLineTwo;
        DeskAssemblyLine deskAssemblyLineThree;
        #endregion

        #region TestFixtureSetUp Init()
        public Lab3DeskAutomationFixture()
        {
            automationController = AutomationController.GetInstance();
            deskAssemblyLineOne = new DeskAssemblyLine(automationController);
            deskAssemblyLineTwo = new DeskAssemblyLine(automationController);
            deskAssemblyLineThree = new DeskAssemblyLine(automationController);
        }
        #endregion

        #region TestFixtureTearDown Dispose()
        public void Dispose()
        {
            automationController = null;
            deskAssemblyLineOne = null;
            deskAssemblyLineTwo = null;
            deskAssemblyLineThree = null;
        }
        #endregion

        #region TestAssemblyLine
        [TestMethod]
        public void TestAssemblyBuildQueue()
        {
            // Create a test order queue
            var orderQue = new Queue<DeskOrder>();
            orderQue.Enqueue(new DeskOrder("Standard", "cherry", "Black"));
            orderQue.Enqueue(new DeskOrder("LeftL", "oak", "White"));
            orderQue.Enqueue(new DeskOrder("RightL", "metal", "Black"));
            orderQue.Enqueue(new DeskOrder("Executive", "particleboard", "Bronze"));
            orderQue.Enqueue(new DeskOrder("Rolltop", "metal", "Bronze"));

            // Fire off test que to the automation controller
            automationController.AddDeskOrders(orderQue);

            // Verify that the completed desk list matches the que
            Assert.AreEqual(5, automationController.CompletedDesks.Count);

            Assert.AreEqual("Cherry standard desk...\n" +
                            "Plastic monitor stand\n" +
                            "Plastic brackets\n" +
                            "Track keyboard tray\n" +
                            "Mouse pad\n" +
                            "Motorized elevator\n" +
                            "Combination stand\n" +
                            "Shelving stand\n" +
                            "Black coating\n", automationController.CompletedDesks[0].ToString());

            Assert.AreEqual("Oak left L desk...\n" +
                            "Plastic monitor stand\n" +
                            "Plastic brackets\n" +
                            "Swivel keyboard tray\n" +
                            "Swivel mouse tray\n" +
                            "Manual elevator\n" +
                            "Combination stand\n" +
                            "Printer shelf\n" +
                            "White coating\n", automationController.CompletedDesks[1].ToString());

            Assert.AreEqual("Metal right L desk...\n" +
                            "Plastic monitor stand\n" +
                            "Plastic brackets\n" +
                            "Swivel keyboard tray\n" +
                            "Swivel mouse tray\n" +
                            "Manual elevator\n" +
                            "Combination stand\n" +
                            "Shelving stand\n" +
                            "Black coating\n", automationController.CompletedDesks[2].ToString());

            Assert.AreEqual("Particleboard executive desk...\n" +
                            "Metal monitor stand\n" +
                            "Metal brackets\n" +
                            "Swivel keyboard tray\n" +
                            "Swivel mouse tray\n" +
                            "Motorized elevator\n" +
                            "File cabinet stand\n" +
                            "Hutch\n" +
                            "Bronze coating\n", automationController.CompletedDesks[3].ToString());
            
            Assert.AreEqual("Metal rolltop desk...\n" +
                            "Plastic monitor stand\n" +
                            "Plastic brackets\n" +
                            "Swivel keyboard tray\n" +
                            "Swivel mouse tray\n" +
                            "Manual elevator\n" +
                            "Combination stand\n" +
                            "Printer shelf\n" +
                            "Bronze coating\n", automationController.CompletedDesks[4].ToString());

        }
        #endregion

    }
}
